< previous page page_467 next page >

Page 467
          ' Draw the 3-D line connecting the points
          ' (x, Data(x, z - 1), z - 1) and
          ' (x, Data(x, z), z).
              :
      Next z
  Next x
Figure 14.2 shows a surface drawn in this way. For smoothly varying surfaces like this one, the line segments appear to cover the surface with rectangles. Nearby lines on the surface do not necessarily lie within the same plane, however, so they actually form "bent rectangles" like the one shown in Figure 14.3.
A Grid Class
To make managing surfaces easier, you can create a Grid3d class. The class should contain variables to describe the data it contains. The class described in this section stores its minimum X and Z values, the spacing between the rows of data in the X and Z directions, and the number of data points in the X and Z directions.
The actual data values are stored in the Points array, a two-dimensional array of Point3D data structures. Point3D structures contain room for a point's original coordinates as well as the coordinates after they have been transformed and projected. This makes Point3D structures useful for storing, projecting, and displaying the data.
e10a6a0a59f035e870d90cca05b85fce.gif
Option Explicit

e10a6a0a59f035e870d90cca05b85fce.gif
Private Xmin As Single      ' Min X and Y values.
Private Zmin As Single 
Private Dx As Single        ' Spacing between rows of data.
Private Dz As Single 
Private NumX As Integer     ' Number of X and Y entries.
Private NumZ As Integer 
Private Points() As Point3D ' Data values.
z0487-01.gif
Figure 14.2
A surface drawn with a grid.

 
< previous page page_467 next page >